import { Space, Checkbox } from "antd";
import { FC } from "react";
import { Typography } from "antd";
const { Title } = Typography

type optionType_check = {
    label:string,
    value:string
}



export type questionCheck_propsType = {
    // [key:string]:any
    title?: string,
    options?: any,
    islock?: boolean,
    onchange?: (newprops: questionCheck_propsType) => void
}

export const questionCheck_defaultValue: questionCheck_propsType = {
    title: '用户多选框',
    options: [
        { label: '选项1', value: '111' },
        { label: '选项2', value: '222' },
        { label: '选项3', value: '333' }
    ],
    
}
const QuestionCheck: FC<questionCheck_propsType> = (props) => {
    const { title, options } = { ...questionCheck_defaultValue, ...props }
    return <>
        <Space direction='vertical'>
            <Title level={3}>{title}</Title>
            <Space >
                {options.map((item: any) => {
                const { label, value, checked = false } = item;
                return (
                    <Checkbox checked={checked} key={value} value={value}>
                    {label}
                    </Checkbox>
                );
                })}
            </Space>
            {/* <Checkbox.Group  options={options} ></Checkbox.Group> */}
        </Space>

    </>
}

export default QuestionCheck